package com.getword.domain;

import com.getword.mongo.annotations.GeneratedLongValue;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.io.Serializable;

@Document(collection = "course")
@Setter
@Getter
@ToString
public class Course implements Serializable {
    @Id
    @Field("_id")
    @GeneratedLongValue
    private long id;// 课程编号，生成规则: c00001...
    private String name; //课程名称
    private String desc; // 课程简介
    @DBRef
    private Grade grade;

    public Course() {
    }

    public Course(Long id, Grade grade) {
        this.id = id;
        this.grade = grade;
    }

    public Course(long id, Grade grade) {
        this.id = id;
        this.grade = grade;
    }

    public Course(Long id) {
        this.id = id;
    }
}
